package com.xzl.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

@WebFilter(filterName = "loginfilter",urlPatterns="/shop")
public class LoginFilter implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.err.println("拦截成功");
        HttpServletRequest req = (HttpServletRequest) servletRequest;
        System.err.println(req.getContextPath());
        filterChain.doFilter(servletRequest,servletResponse);
    }
}
